<?php 
	require 'inc.db.php';
	require 'functions.php';
	session_start();
		
	$bestelling = getAll();
		
	if(isset($_POST['delete'])){
		if(delete($_POST['id']) === true){
			header('Location: verander.php?delete=succes');	
		}else{
			header('Location: verander.php?delete=fout');	
		}
	}
	
	if($_GET['delete'] == 'succes'){
		$msg = 'Bestelling is met succes verwijderd';	
	}
	if($_GET['delete'] == 'fout'){
		$msg = 'Er ging iets mis';
	}
	
	if($_GET['update'] == 'succes'){
		$msg = 'Bestelling is met succes gewijzigd';	
	}
	if($_GET['update'] == 'fout'){
		$msg = 'Er ging iets mis';
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Eindtoets</title>
<link href="../data/css/main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
table{
	font-size:12px;
}

td{
	padding:5px;
}

#bevestig{
	padding:5px;
	float:right;
	margin-top:10px;
}
input {padding:5px;}

td a{
	padding:5px;
	background:#FFF;
	border:1px solid #000;
	color:#000;
}

td a:hover{
	padding:5px;
	background:#000;
	border:1px solid #FFF;
	color:#FFF;
}
</style>
</head>

<body>
<div id="main_bg"><img src="../data/images/main_bg.jpg" alt="main bg" /></div>

<div id="wrapper">
	<!-- header -->
    	<div id="header">
        	<div id="left_bow"></div>
            	<div class="placer">
                	<div id="logo"><img src="../data/images/logo.png" alt="logo" /></div>
                </div>
            <div id="right_bow"></div>
        </div>

       <?php include 'menu.php'; ?>
        
        <!-- content -->
    <div id="content">
        <div class="placer">
        	<!-- col left -->
        	<div id="col_left">
                <div class="field">
                    <div class="bg_top"></div>
                    <div class="bg_mid">
                        <h2>Delete</h2>
                        <p><?= $msg; ?></p>
                        <table cellpadding="5" border="1">
                        <thead>
                        	<th>ID</th>
                            <th>Producten</th>
                            <th>Totaal</th>
                            <th>Verwijder</th>
                            <th>Wijzig</th>
                        </thead>
                        
                        <tbody>
                        <?= $bestelling; ?>
                        </table>
                        </tbody>
                    </div>
                    <div class="bg_bottom"></div>
              </div>
          </div>
          <!-- end col left -->
          
          <!-- col right -->
        	<div id="col_right">
                <div class="field">
                    <div class="bg_top"></div>
                    <div class="bg_mid">         
                        <h2 class="sec">Mijn projecten</h2>
                        <ul>
                        	<li><a href="http://tim-design.nl" target="_blank">HoeWasMijnVakantie.nl</a></li>
                            <li><a href="http://manitavoetverzorging.nl" target="_blank">Manitavoetverzorging.nl</a></li>
                            <li><a href="http://min40celsius.nl" target="_blank">Min40celsius.nl</a></li>
                            <li><a href="http://heurnsmannenkoor.nl" target="_blank">Heurnsmannenkoor.nl</a></li>
                            <li><a href="http://mytraintravels.com" target="_blank">Mytraintravels.com (in ontwikkeling)</a></li>
                            <li><a href="http://sitevisie.nl" target="_blank">Sitevisie.nl (in ontwikkeling)</a></li>
                        </ul>
                    </div>
                    <div class="bg_bottom"></div>
              </div>
          </div>
          <!-- end col right -->
        </div>
    </div>
    <!-- end content -->
</div>
</body>
</html>